﻿namespace TestNewGuiFramework
{
    using Pps.Gui.Controls;

    internal class HeatpumpWindow : BaseWindow
    {
        private Label superheatOut;
        private Label compressorOut;
        private Label condenserOut;
        private Label evaporatorOut;
        private Label highpressureErrorLabel;
        private Label lowpressureErrorLabel;

        private Led highpressureError;
        private Led lowpressureError;

        public HeatpumpWindow()
        {
            this.InitializeControls();
        }

        protected override void InitializeControls()
        {
            base.InitializeControls();

            this.compressorOut = new Label("Kompressor: 10.0 °C", 280, 50);

            this.condenserOut = new Label("Verflüssiger: 28.2 °C", 280, 120);

            this.evaporatorOut = new Label("Verdampfer: 3.0 °C", 280, 190);

            this.superheatOut = new Label("Überhitzer: 12.0 °C", 280, 260);

            this.highpressureErrorLabel = new Label("Hochdurckstörung: ", 280, 330);
            this.lowpressureErrorLabel = new Label("Niederdruckstörung: ", 280, 400);

            this.highpressureError = new Led(650, 335, 25);
            this.lowpressureError = new Led(650, 405, 25);

            this.heatpump.Selected = true;
            this.heatpump.Enabled = false;

            this.AddControlsToWindow();
        }

        protected override void AddControlsToWindow()
        {
            base.AddControlsToWindow();

            this.AddChildControl(this.superheatOut);
            this.AddChildControl(this.compressorOut);
            this.AddChildControl(this.condenserOut);
            this.AddChildControl(this.evaporatorOut);
            this.AddChildControl(this.lowpressureErrorLabel);
            this.AddChildControl(this.highpressureErrorLabel);
            this.AddChildControl(this.highpressureError);
            this.AddChildControl(this.lowpressureError);
        }

        protected override void Update()
        {
            System.Random test = new System.Random();

            this.compressorOut.Text = "Kompressor: " + test.Next(100).ToString("F1") + " °C";
            this.condenserOut.Text = "Verflüssiger: " + test.Next(100).ToString("F1") + " °C";
            this.evaporatorOut.Text = "Verdampfer: " + test.Next(100).ToString("F1") + " °C";
            this.superheatOut.Text = "Überhitzer: " + test.Next(100).ToString("F1")  + " °C";
        }

    }
}